package com.telit.android.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.telit.android.entity.CommMsgCenterLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
import java.util.List;


/**
 * @Auther amy
 * @Describe
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CommMsgCenterLogDTO extends CommMsgCenterLog implements Serializable {
    /**
     * 主键id
     */
    @ApiModelProperty(value="主键id")
    @TableId(type= IdType.AUTO)
    private Long id;

    /**
     * 用户id
     */
    @ApiModelProperty(value="接收人id")
//    @NotNull(message = "用户id不能为空")
    private Long userId;

    /**
     * 创建时间
     */
    @ApiModelProperty(value="创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 消息来源，默认1(森林防火平台)，字典-msg_push_resource
     */
    @ApiModelProperty(value="消息来源")
    private String msgResource;

    /**
     * 消息类型,字典-msg_push_type
     */
    @ApiModelProperty(value="消息类型")
    @NotBlank(message = "消息类型不能为空")
    private String msgType;

    /**
     * 标题
     */
    @ApiModelProperty(value="标题")
    @NotBlank(message = "标题不能为空")
    private String title;

    /**
     * 内容
     */
    @ApiModelProperty(value="内容")
    @NotBlank(message = "内容不能为空")
    private String msgContent;

    /**
     * 发送平台，1(阿里云推送),2(webSocket)
     */
    @ApiModelProperty(value="发送平台")
    private String sendPlatform;

    /**
     * 创建人
     */
    @ApiModelProperty(value="创建人")
    private String createUser;

    @ApiModelProperty(value="消息状态,0是未读,1是已读")
    private String hasRead;

    public CommMsgCenterLogDTO(String content, String msgType, Date createTime, String sendPlatform, String createUser, String title, List<Long> userIdList){
        this.msgContent = content;
        this.msgType = msgType;
        this.createTime = createTime;
        this.sendPlatform = sendPlatform;
        this.createUser = createUser;
        this.title = title;
        this.userIdList = userIdList;
    }

    @ApiModelProperty(value="消息类型描述")
    private String msgTypeDesc;

    @ApiModelProperty(value="消息来源描述")
    private String msgResourceDesc;

    @ApiModelProperty(value = "用户id集合")
    private List<Long> userIdList;

    private static final long serialVersionUID = 1L;

}
